package com.cskaoyan.user.controller;


import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;


/**
 * @Author:WalterChan
 * @Decription:LogoutController
 * @Date Created in 2023-01-11-0:26
 */
@RestController
@RequestMapping("/user")
public class LoginOutController {

    private static String ACCESS_TOKEN = "access_token";
    @GetMapping("/loginOut")
    public ResponseData logout(HttpServletResponse response){

        Cookie cookie = new Cookie(ACCESS_TOKEN, null);
        cookie.setPath("/");
        response.addCookie(cookie);

        return  new ResponseUtil().setData(null);

    }

}
